package com.fanhao.dllo.justforyou.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.fanhao.dllo.justforyou.factory.JokeFragmentFactory;

/**
 * Created by dllo on 15/10/23.
 */
public class JokeAdapter extends FragmentPagerAdapter {

    private String[] titles = {"段子","图片"};

    public JokeAdapter(FragmentManager fm) {

        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        return JokeFragmentFactory.createFragment(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {

              return titles[position];
    }
}
